from django.http import get_host
from django.utils.html import escape

from django.shortcuts import render_to_response
from django.template import RequestContext

def render_response(request, *args, **kwargs):
  kwargs['context_instance'] = RequestContext(request)
  return render_to_response(*args, **kwargs)

def get_url_host(request):
  if request.is_secure():
    protocol = 'https'
  else:
    protocol = 'http'
  host = escape(get_host(request))
  return '%s://%s' % (protocol, host)

def get_full_url(request):
  return get_url_host(request) + request.get_full_path()
